<template>
	<view class="container">
		<view class="jzrlist">

			<view class="jzrlist_dl" v-for="(item,index) in rows" :key="item.id">
				<view class="jzrlist_dt" @click="xuanz" :data-index="index">
					<view class="jzrlist_dttop">{{item.name}}<text>{{item.mobile}}</text><text class="on"
							v-if="item.mrdata==1">默认</text></view>
					<!-- <view class="jzrlist_ddbot"><text>邮箱：{{item.email}}</text></view> -->
					<!-- <view class="jzrlist_ddbot"><text>性别：{{item.sex}}</text><text>出生日期：{{item.birthday}}</text></view> -->
				</view>
				<view class="jzrlist_dd" @click="edit" :data-id="item.id"><text class="iconfont icon-bianji"></text>编辑
				</view>
			</view>



		</view>
		<navigator hover-class="none" open-type="navigate" url="/pages/user/jzrform/jzrform">
			<view class="jzr_addbtn">+ 添加预约人</view>
		</navigator>
	</view>
</template>

<script>
	import API from "@/common/api.js"
	export default {
		data() {
			return {
				rows: [],

			}
		},
		onLoad(options) {
			if (options.fromjzr != undefined) {
				uni.setStorageSync("fromjzr", 1)
			}
		},
		onShow() {
			var $this = this
			API.post("common/addressList").then((res) => {
				if (res.code == 1) {
					$this.rows = res.data
				}
			})
		},
		methods: {
			xuanz(e) {
				var from = uni.getStorageSync("fromjzr")
				if (from == 1) {
					var index = e.currentTarget.dataset.index;
					uni.$emit('addUserInfo', this.rows[index])
					uni.setStorageSync("fromjzr", 0)
					uni.navigateBack({
						delta: 1
					})
				}

			},
			edit(e) {
				var id = e.currentTarget.dataset.id;
				uni.navigateTo({
					url: "/pages/user/jzrform/jzrform?id=" + id
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #f7f7f7;
	}

	.jzr_addbtn {
		margin: 40rpx 30rpx;
		overflow: hidden;
		text-align: center;
		border-radius: 20rpx;
		background: #ecf2ff;
		color: $color;
		font-size: 32rpx;
		font-weight: bold;
		height: 136rpx;
		line-height: 136rpx;
	}

	.jzrlist {
		padding: 10rpx 30rpx 0;
		width: 100%;
		overflow: hidden;
		box-sizing: border-box;
	}

	.jzrlist_dl {
		width: 100%;
		overflow: hidden;
		box-sizing: border-box;
		padding: 36rpx 30rpx;
		border-radius: 20rpx;
		background: #fff;
		display: flex;
		line-height: 40rpx;
		margin-top: 28rpx;
	}

	.jzrlist_dt {
		flex: 1;
	}

	.jzrlist_dd {
		font-size: 28rpx;
		color: $color;
	}

	.jzrlist_dd text {
		font-size: 28rpx;
		margin: 0 10rpx 0 0;
		float: left;
	}

	.jzrlist_dttop {
		font-size: 36rpx;
		font-weight: bold;
		width: 100%;
		overflow: hidden;
	}

	.jzrlist_dttop text {
		display: inline-block;
		margin-left: 16rpx;
		font-size: 26rpx;
		font-weight: normal;
	}

	.jzrlist_dttop text.on {
		font-size: 24rpx;
		color: #fff;
		line-height: 36rpx;
		border-radius: 8rpx;
		padding: 0 10rpx;
		background: #1bc597;
		margin-top: 2rpx;
	}

	.jzrlist_ddbot {
		font-size: 28rpx;
		color: #666;
		margin-top: 24rpx;
	}

	.jzrlist_ddbot text {
		display: inline-block;
		margin-right: 30rpx;
	}
</style>